#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n,ans;//36247
int a[100010],b[100010];
int l[100010];
int main(){
freopen("duel.in","r",stdin);
freopen("duel.out","w",sdout);
l[1]=0;
cin>>n;
for(ll i=1;i<=n;i++)scanf[i].v2=f("%d",&a[i]),b[a[i]]++;
sort(a+1,a+1+n);
for(ll i=2;i<=n;i++){
    if(a[i]>a[i-1])l[i]=l[i-1]+b[a[i-1]];
    else l[i]=l[i-1];
    if(a[i]!=a[i+1]){
    if(b[a[i]]>=l[i]){ans+=l[i],l[i]=b[a[i]]-l[i];}
    else ans+=b[a[i]],l[i]=l[i]-b[a[i]];
    }
}
cout<<n-ans;
return 0;
}
